date <- c("20251001","20251002","20251003","20251004","20251005","20251006","20251007","20251008","20251009","20251010","20251011","20251012","20251013","20251014","20251015","20251016","20251017","20251018","20251019","20251020","20251021","20251022","20251023","20251024","20251025","20251026","20251027","20251028","20251029","20251030","20251031")
weight1 <- c(54,54.6,54.6,54,54,54.2,54.6,55.7,54.5,54.3,55.1,54.3,54.3,55.2,54.2,54.6,54.2,54.6,53.9,54.8,54.7,54.8,54.4,54.6,54.8,55.4,55.1,55.2,55.2,55,54.9)
weight2 <- c(53.4,53.2,53.2,52.9,53.3,53.2,53.2,53.4,53.3,53.4,53.2,53.8,53.9,53.5,53.8,53.8,53.9,53.7,53.4,53.6,53.8,54,53.6,54,54,54.7,54.2,53.8,54.5,54.1,54.1)
energy <- c(1768.528,1764.367,1756.336,2279.368,1769.574,1727.421,2155.346,1733.161,1744.502,1748.687,2179.762,1774.788,1741.605,1749.505,1760.305,1765.213,1734.854,1982.967,1690.378,1738.591,1767.752,1746.082,1802.489,1710.544,2501.960,1748.915,1746.357,2070.634,1801.260,1729.803,1736.084)
opar <- par(mar = c(5,4,4,5))
plot(c(1:31),weight1,type="s",col="red",xaxt="n",xlab = "date",ylab = "weight(kg)",ylim=range(52.4:56.2))
lines(c(1:31),weight2,type="s",col="blue")
legend("topright",inset=.05,title="体重曲线",c("睡前","醒后(辅助线:50.5~51.5)","热量"),lty=c(1,1,1),col=c("red","blue","green"))
abline(h = 51.5,col="blue",lty = 3)
abline(h = 50.5,col="blue",lty = 3)
axis(1, c(1:31),date)
par(new = TRUE)
plot(c(1:31), energy,type="s", pch = "+", col = "green", axes = FALSE, xlab = "", ylab = "")
axis(side = 4, at = pretty(range(energy)))
mtext("energy(kcal)", side = 4, line = 3)